package kr.couponplay.android.activity.search;

import java.util.ArrayList;
import java.util.List;

import android.graphics.Color;
import android.graphics.Typeface;
import android.view.View;
import android.widget.Button;

public class SearchSubMenuHelper {
	private static List<Button> subMenuButtons = new ArrayList<Button>();

	public static Button get(int position) {
		return subMenuButtons.get(position);
	}

	public static void add(Button button) {
		if (subMenuButtons == null) {
			subMenuButtons = new ArrayList<Button>();
		}
		subMenuButtons.add(button);
	}

	public static List<Button> getSubMenuButtons() {
		return subMenuButtons;
	}

	public static int getPosition(View view) {
		for (int i=0; i<subMenuButtons.size(); i++) {
			if (subMenuButtons.get(i) == view) {
				return i;
			}
		}
		return 0;
	}
	
	public static void drawSelectButton(View view) {
		for (Button button : subMenuButtons) {
			if (button == view) {
				button.setBackgroundColor(Color.parseColor("#C9C9C9"));
				button.setTextColor(Color.parseColor("#1A1C22"));
				button.setTypeface(null,Typeface.BOLD);
			} else {
				button.setBackgroundColor(Color.parseColor("#F2F2F2"));
				button.setTextColor(Color.parseColor("#727272"));
				button.setTypeface(null,Typeface.NORMAL);
			}
		}		
	}
	
	public static void clear() {
		subMenuButtons.clear();
	}
}
